//
//  FZ_BoFangTouXiangCreatViewDongH.m
//  ProjectOfBStage
//
//  Created by dllo on 15/11/18.
//  Copyright © 2015年 cuixin. All rights reserved.
//

#import "FZ_BoFangTouXiangCreatViewDongH.h"
#import "BaseHeader.h"
@interface FZ_BoFangTouXiangCreatViewDongH ()
@property (nonatomic , retain) UIView *viewTouXiangB;
@property (nonatomic , retain) UIImageView *imageViewTouXiangB;
@end
@implementation FZ_BoFangTouXiangCreatViewDongH

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    
    if (self) {
        
        self.viewTouXiangB = [[UIView alloc] initWithFrame:frame];
        self.viewTouXiangB.backgroundColor = [UIColor clearColor];
        
        self.viewTouXiangB.userInteractionEnabled = YES;
        self.viewTouXiangB.layer.shadowOpacity = 1;
        self.viewTouXiangB.layer.shadowColor = [UIColor yellowColor].CGColor;
        self.viewTouXiangB.layer.shadowRadius = 10;
        self.viewTouXiangB.layer.cornerRadius = 40;
        self.viewTouXiangB.layer.borderColor = [UIColor clearColor].CGColor;
        self.viewTouXiangB.layer.borderWidth = 2;
        UIImage *imageRight = RIGHT_ITEM_BAR;
        imageRight = [imageRight imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        [self.imageViewTouXiangB removeFromSuperview];
        self.imageViewTouXiangB = [[UIImageView alloc] initWithFrame:self.viewTouXiangB.frame];
        self.imageViewTouXiangB.image = imageRight;
        self.imageViewTouXiangB.layer.cornerRadius = 40;
        self.imageViewTouXiangB.clipsToBounds = YES;
        self.imageViewTouXiangB.layer.masksToBounds = YES;
        self.imageViewTouXiangB.layer.backgroundColor = [UIColor blackColor].CGColor;
        self.imageViewTouXiangB.layer.borderWidth = 2;
        self.imageViewTouXiangB.layer.borderColor = [UIColor whiteColor].CGColor;
        self.imageViewTouXiangB.userInteractionEnabled = YES;
        [self.viewTouXiangB addSubview:self.imageViewTouXiangB];
        [_imageViewTouXiangB release];
        
        CABasicAnimation *basicanimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
        [basicanimation setDuration:3];
        [basicanimation setRepeatCount:NSIntegerMax];
        [basicanimation setFromValue:[NSNumber numberWithInt:0]];
        [basicanimation setToValue:[NSNumber numberWithFloat:M_PI * 2]];
        [self.imageViewTouXiangB.layer addAnimation:basicanimation forKey:@"transform"];
        basicanimation.autoreverses = YES;
        [self addSubview:self.viewTouXiangB];
        [_viewTouXiangB release];
    }
    return self;
}

- (void)removeAnimat{
    [self.imageViewTouXiangB.layer removeAllAnimations];
}


@end
